<template>
  <base-dialog ref="basedialog" @handleConfrim="handleConfrim">
    <el-checkbox-group v-model="tableCol">
      <el-checkbox
        v-for="(item, index) in tabelListDic"
        :key="index"
        :label="item.props"
        >{{ item.title }}</el-checkbox
      >
    </el-checkbox-group>
  </base-dialog>
</template>




<script>
export default {
  data() {
    return {
      tableCol: [],
      tabelListDic: [], //表格字段组
      tabelecolum: [], //表格列配置组
      setView: [],
    };
  },
  watch: {
    tableCol(v) {
        this.setView = []
      if (this.$parent && this.$parent.tableOptions) {
        if (v && v.length) {
          v.forEach((item) => {
            this.tabelecolum.forEach((el) => {
              if (el.props == item) {
                this.setView.push(el);
              }
            });
          });
        }
      }
    },
  },
  methods: {
    open() {
      this.$refs.basedialog.open();
    },
    close() {
      this.$refs.basedialog.close();
    },
    handleConfrim() {
      this.$parent.tableOptions.cols = [];
      this.$parent.tableOptions.cols = this.setView;
    },
  },
};
</script>